cmake_minimum_required(VERSION 3.10)

project("socket")

# 定义顶级文件目录
set(ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/")

# 指定头文件路径
include_directories(./)
include_directories(${ROOT_PATH}/tcp/include)
include_directories(${ROOT_PATH}/udp/include)

# 添加源文件
aux_source_directory(${ROOT_PATH}/tcp SRCFILES)
aux_source_directory(${ROOT_PATH}/udp SRCFILES)

#  定义可执行文件名
add_executable(socket main.c ${SRCFILES})

SET(CMAKE_BUILD_TYPE "Debug")
# c++
# SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb -lpthread")
# SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")
# c
SET(CMAKE_C_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb -lpthread -fsanitize=address -fsanitize=leak")
SET(CMAKE_C_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")